Dynamic programming environments provide developers with convenient and flexible techniques in authoring programs (e.g., heterogeneous use of types, extreme polymorphism, duck typing, and prototypal inheritance). Runtime infrastructures for dynamic programming environments run scripts to provide the fastest possible execution of common programs, and use various combinations of techniques and strategies to accomplish convenience and flexibility.
While these techniques and strategies employed in implementations of runtime infrastructures for dynamic programming environments can provide potential convenience and flexibility, the corresponding potential representations of objects that can be employed in the dynamic programming environment are typically highly non-optimal and it can be extremely difficult to discover the best object representations. The highly non-optimal object representations can be a significant factor that can cause dynamic programming environments to be up to ten times slower than equivalent static environments. Even when developers use dynamic object representations in constrained ways that can potentially be represented more optimally, the runtime does not immediately recognize the constrained object representation. Instead, techniques such as tracing and profile-guided-optimization are typically used to discover how objects are being utilized and adjust code generation. However, these techniques employ heuristics and take time to recognize patterns before speed-ups are recognized. These dynamic programming environment problems are specifically notable with ECMAScript-based dynamic languages.